home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / shots / BugAFireA.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.2 KB  |  94 lines

  1. class classes.shots.BugAFireA
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var dir;
  7.    var clip;
  8.    var axis;
  9.    var xMov = 0;
  10.    var yMov = 0;
  11.    var Name = "bugAFireA";
  12.    var power = 20;
  13.    var yank = false;
  14.    var black = false;
  15.    function BugAFireA(px, py, pDir, pid, pblack)
  16.    {
  17.       this.x = px;
  18.       this.y = py;
  19.       this.id = pid;
  20.       this.dir = pDir;
  21.       this.black = pblack;
  22.       _root.d = _root.d + 1;
  23.       this.clip = _root.attachMovie("bugAFireA","bugAFireA" + this.id + "Clip",_root.d);
  24.       this.clip._x = this.x;
  25.       this.clip._y = this.y;
  26.       this.clip.id = this.id;
  27.       if(this.dir == "U")
  28.       {
  29.          this.axis = "y";
  30.          this.yMov = -13;
  31.          this.xMov = 0;
  32.          this.y += 13;
  33.       }
  34.       else if(this.dir == "D")
  35.       {
  36.          this.axis = "y";
  37.          this.yMov = 13;
  38.          this.xMov = 0;
  39.          this.y -= 13;
  40.       }
  41.       else if(this.dir == "R")
  42.       {
  43.          this.axis = "x";
  44.          this.yMov = 0;
  45.          this.xMov = 13;
  46.          this.x -= 13;
  47.       }
  48.       else
  49.       {
  50.          this.axis = "x";
  51.          this.yMov = 0;
  52.          this.xMov = -13;
  53.          this.x += 13;
  54.       }
  55.       this.xMov *= _root.dif.speed;
  56.       this.yMov *= _root.dif.speed;
  57.       this.clip.gotoAndStop(this.dir);
  58.       if(this.black)
  59.       {
  60.          var _loc3_ = new flash.geom.Transform(this.clip);
  61.          var _loc4_ = new flash.geom.ColorTransform(0,0,0,1,-255,-255,-255,0);
  62.          _loc3_.colorTransform = _loc4_;
  63.       }
  64.       this.xMov *= _root.randRange2(0.9,1.1);
  65.       this.yMov *= _root.randRange2(0.9,1.1);
  66.    }
  67.    function hit()
  68.    {
  69.       this.yank = true;
  70.    }
  71.    function main()
  72.    {
  73.       this[this.axis + "Mov"] *= 1.02;
  74.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  75.       {
  76.          _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  77.          this.yank = true;
  78.       }
  79.       if(this.x > 1050 || this.x < -50 || this.y > 650 || this.y < -50)
  80.       {
  81.          this.yank = true;
  82.       }
  83.       if(this.yank)
  84.       {
  85.          _root.removeEnemyShot("bugAFireA" + this.id);
  86.          this.yank = false;
  87.       }
  88.       this.x += this.xMov;
  89.       this.y += this.yMov;
  90.       this.clip._x = this.x;
  91.       this.clip._y = this.y;
  92.    }
  93. }
  94.